package pen_exam.manbang2023_11_08;

import java.util.Scanner;

public class Class02_nixudui {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int k = Integer.parseInt(s[1]);
        int[] res =  res(n,k);
        for (int i = 0; i < res.length; i++) {
            System.out.print(res[i]);
        }
    }

    public static int[] res(int n,int k){
        int[] res = new int[n];
       process(res,n,n,k);
       int ans = 1;
       int index = 0;
       while (index != res.length){
           if(res[index] == 0){
               res[index] = ans++;
           }
           index++;
       }
        return res;
    }
    //res : 操作的字符
    // i：目前使用的字符位置
    // k ： 需要的逆序对
    public static void process(int[] res,int i,int n,int k){
        if(k <= i - 1){
            res[i - k - 1] = i;
            return;
        }
        if(k > i - 1){
            res[n - i] = i;
            process(res,i - 1,n,k - i );
        }
    }

}
